<?php
require_once "../funciones.php";
autenticado();
$caweb = con_intranetpccom();
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link type="text/css" href="../css/redmond/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
        <link rel="stylesheet" type="text/css" media="screen" href="../css/ui.jqgrid.css" />
        <link rel="stylesheet" type="text/css" media="screen" href="../css/ui.multiselect.css" />
        <link rel="stylesheet" href="../css/thickbox.css" type="text/css" media="screen" />
        <script src="../js/jquery.js" type="text/javascript"></script>
        <script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
        <script src="../js/i18n/grid.locale-sp.js" type="text/javascript"></script>
        <script src="../js/jquery.jqGrid.min.js" type="text/javascript"></script>
        <title>Consulta Incidencias</title>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#fecIni").datepicker({dateFormat:"yy-mm-dd"});
                $("#fecFin").datepicker({dateFormat:"yy-mm-dd"});

                jQuery("#multiple37").jqGrid({
                    url:'',
                    datatype: "xml",
                    colNames:['Inc','Fecha Creacion','Creo','Empresa','Descripcion','Sistema'],
                    colModel:[
                        {name:'rq', index:'rq', width:70,align:"center"},
                        {name:'reqFec',index:'reqFec', width:175,align:"center"},
                        {name:'reqUsr', index:'reqUsr', width:180,align:"rigth"},
                        {name:'texto4', index:'texto4', width:120,align:"center"},
                        {name:'reqDes', index:'reqDes', width:340,align:"rigth",editable:true},
                        {name:'sisNombre', index:'sisNombre', width:120,align:"center"}
                    ],
                    rowNum:30,
                    rowList:[30,50,100],
                    sortorder: "asc",
                    pager: jQuery('#pmultiple37'),
                    sortname: 'rq',
                    viewrecords: true,
                    height: '80%',
                    subGrid : true,
                    cellEdit: true,
                    cellsubmit: 'clientArray',
                    editurl: 'prueba.php',
                    subGridUrl: '../scripts/detalleRequerimientos.php',
                    toolbar: [true,"top"],
                    subGridModel: [
                        {name:['No','Fecha','Responsable','Estado','Tipo','Descripcion'],
                            width : [30,160,160,100,100,460]}
                    ],
                    caption:"Incidencias Generadas"
                });

                jQuery("#multiple37").jqGrid('navGrid','#pmultiple37',{edit:false,add:false,del:false,search:true,refresh:true }, {},{},{},{multipleSearch:true});
                jQuery("#multiple37").jqGrid('gridResize',{minWidth:350,maxWidth:1800,minHeight:80, maxHeight:1800});

                $("#consultar").click(function(){
                    var varurl = '../scripts/adminconsultasRequerimientos.php?q=1&' + $("#formConsultas").serialize();
                    jQuery('#multiple37').jqGrid('setGridParam',{url: varurl}).trigger('reloadGrid')
                    varurl = '../scripts/adminconsultasRequerimientos.php?' + $("#formConsultas").serialize();
                    $.post(varurl, {q: 2}, function(vhtml){
                        $("#prueba").html(vhtml);
                    });
                }); //fin $("#consultar").click(function(){
            }); //$(document).ready(function(){

            function mayusculas(obj){
                obj.attr("value",obj.val().toUpperCase());
            } //fin function mayusculas(obj){

        </script>
    </head>
    <style type="text/css">
        .estadistica{
            border-collapse: separate;
            border-spacing: 10px 2px;
            border-style: outset;
            border-width: 5px;
            vertical-align: top;
            text-align: center;
        }
        .estadistica th{
            font-style: oblique;
            font-weight: bolder;
            background-color:#58ACFA;
            color: white;
            font-size: 14px;
        }
        .estadistica tfoot{
                    font-weight: bolder;
                    background-color:#848484;
                    color: white;
        }
        .estadistica td{
            border-style: groove;
            border-width: 2px;
            text-align: center;
        }

        .principal{
            border-collapse: separate;
            border-spacing: 10px 10px;
            text-align: left;
            vertical-align: top;
        }

        .principal td{
            text-align: left;
            vertical-align: top;
}


    </style>
    <body>
        <form name="formConsultas" id="formConsultas" method="post">
        <table>
            <caption>CONSULTA INCIDENCIAS</caption>
            <tr>
                <td><label for="sistema">Sistema</label></td>
                <td>
                    <select name="sistema" id="sistema">
                        <option value ="">Todos...</option>
                        <?php
                        $sql = "select sisNombre,sisId from sistemas order by sisNombre";
                        $result = mysql_query($sql);
                        while($row = mysql_fetch_array($result)){
                            echo "<option value='{$row['sisId']}'>".$row['sisNombre']."</option>";
                        }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="reqId">Incidencia</label></td>
                <td><input type="text" name="reqId" id="reqId" size="5" /></td>
                <td><label for="estado">Estado</label></td>
                <td>
                    <select name="estado" id="estado">
                        <option value ="">Todos...</option>
                        <?php
                        $sql = "select estRqId,estRqNombre from estadosRq order by estRqNombre";
                        $result = mysql_query($sql);
                        while($row = mysql_fetch_array($result)){
                            echo "<option value='{$row['estRqId']}'>".$row['estRqNombre']."</option>";
                        }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="tipo">Tipo</label></td>
                <td >
                    <select id="tipo" name="tipo">
                        <option value="">Todos</option>
                    <?php
                        $sql = "select tipRqId,tipRqNombre from tiposRq order by tipRqNombre";
                        $result = mysql_query($sql);
                        while($row = mysql_fetch_array($result)){
                            /*if($row['tipRqId'] == 1) //omite estado analisis
                                continue;*/
                            echo "<option value='{$row['tipRqId']}'>".$row['tipRqNombre']."</option>";
                        }
                    ?>
                    </select>
                </td>
                <td><label for="empresa">Empresa</label></td>
                <td>
                    <select name="empresa" id="empresa" >
                        <option value ="">Todas...</option>
                        <?php
                        $sql = "select empresa,texto4 from empresas order by texto4";
                        $result = mysql_query($sql);
                        while($row = mysql_fetch_array($result)){
                            echo "<option value='{$row['empresa']}'>".$row['texto4']."</option>";
                        }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="responsable">Responsables</label></td>
                <td >
                    <select id="responsable" name="responsable">
                        <option value="">Todos</option>
                    <?php
                        $sql = "select username,apellidos,nombres from usuarios where grupo = 'Sistemas' and estado = 'A' and entrada = 'pccom' order by apellidos";
                        $result = mysql_query($sql);
                        while($row = mysql_fetch_array($result)){
                            echo "<option value='{$row['username']}'>".$row['apellidos']." ".$row['nombres']."</option>";
                        }
                    ?>
                    </select>
                </td>
                <td><label for="estResp">Estado Responsable</label></td>
                <td>
                    <select name="estResp" id="estResp" >
                        <option value ="">Todas...</option>
                        <option value ="pendientes">Pendientes</option>
                        <option value ="realizados">Realizados</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="fecIni">Fecha Inc Inicial</label></td>
                <td><input type="text" name="fecIni" id="fecIni" size="9" /></td>
                <td><label for="fecFin">Fecha Inc Final</label></td>
                <td><input type="text" name="fecFin" id="fecFin" size="9" /></td>
            </tr>
            <tr align="center">
                <td colspan="4">
                    <input type="button" Value="Consultar" name="consultar" id="consultar" />
                    <input type="button" Value="Cancelar" onclick="location.reload();" />
                </td>
            </tr>
        </table>
            </form>
        <table id="multiple37"></table>
        <div id="pmultiple37" ></div>
        <br />
        <br />
        <div id="prueba"></div>
        <?php
        // put your code here
        ?>
    </body>
</html>